package com.spic.system.api;

import com.spic.common.core.constant.ServiceNameConstants;
import com.spic.common.core.domain.R;
import com.spic.system.api.domain.SysDept;
import com.spic.system.api.factory.RemoteDeptFallbackFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @Description 部门服务
 * @Author AnQi
 * @Date 2021/11/28
 */
@FeignClient(contextId = "remoteDeptService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteDeptFallbackFallbackFactory.class)
public interface RemoteDeptService {
    /**
     * 通过roleId获取部门
     *
     * @param roleId
     * @return
     */
    @GetMapping("/dept/custom_dept")
    R<List<Long>> getCustomDeptIds(@RequestParam("roleId") Long roleId);

    /**
     * 获取当前部门及子部门
     *
     * @param deptId
     * @return
     */
    @GetMapping("/dept/dept_and_children")
    R<List<Long>> getDeptAndChildren(@RequestParam("deptId") Long deptId);


    /**
     * 获取当前部名称
     *
     * @param deptId
     * @return
     */
    @GetMapping("/dept/dept_name")
    R<String> getDeptName(@RequestParam("deptId") Long deptId);

    /**
     * 通过部门id查询部门领导id
     *
     * @param deptIds
     * @return
     */
    @GetMapping("/dept/getDeptLeaderIdDeptIds")
    R<List<Long>> getDeptLeaderIdDeptIds(@RequestParam("deptIds") String deptIds);

    /**
     * 新增部门
     */
    @PostMapping("/dept/addNoAuth")
    R<Long> addDept(@RequestBody(required = false) SysDept sysDept);


    @GetMapping("/dept/cache2")
    R<java.util.Map<String, Long>> cache2();


    @GetMapping("/dept/getSysDeptBychildenId")
    R<String> getSysDeptBychildenId(@RequestParam("deptId") Long deptId);

}
